// 用户模块的vuex的操作

import {
  setStorageToken,
  getStorageToken,
  removeStorageToken
} from '@/utils/storage'

const state = {
  token: getStorageToken()
}

const mutations = {
  setToken(state, payload) {
    state.token = payload

    setStorageToken(payload)
  },
  removeToken(state) {
    state.token = {}

    removeStorageToken()
  }
}
const getters = {}
const actions = {}

export default {
  state,
  mutations,
  getters,
  actions,
  namespaced: true
}
